package com.bckj.fastboot.iot.common.dto.msg;

import com.bckj.fastboot.iot.common.constant.IotMQConstants;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * IotProtocolMessage
 *
 * @author wfc
 **/
@Data
@Accessors(chain = true)
public class IotProtocolDataMessage {
    private String devModel;
    private String devCode;
    private String tag;
    private String payload;

    public IotProtocolDataMessage of(String tag, String devModel, String devCode, String payload) {
        var r = new IotProtocolDataMessage();
        r.tag = tag;
        r.devModel = devModel;
        r.devCode = devCode;
        r.payload = payload;
        return r;
    }

    public static IotProtocolDataMessage ofMqtt(String devModel, String devCode, String payload) {
        return new IotProtocolDataMessage().of(IotMQConstants.IOT_PROTOCOL_DATA_MATT_TAG, devModel, devCode, payload);
    }

    public static IotProtocolDataMessage ofJson(String devModel, String devCode, String payload) {
        return new IotProtocolDataMessage().of(IotMQConstants.IOT_PROTOCOL_DATA_JSON_TAG, devModel, devCode, payload);
    }

}
